 
    	window.onload = function(){
			size=document.body.clientWidth/30;
			document.getElementsByTagName("html")[0].style.fontSize = size+"px";
			
			var canvas = document.getElementById("canvas");
			canvas.width = document.body.clientWidth;
			canvas.height = document.body.clientHeight;
			
			var snow_x = new Array();
			var snow_y = new Array();
			var fontSizes = new Array();
			for(var i = 0 ; i < 100 ; i++){
				snow_x[i] = Math.random()*canvas.width;
				snow_y[i] = -1*Math.random()*canvas.height;
				fontSizes[i] = Math.random()*30+20;
			}
			
			//获取context2d
			var context = canvas.getContext("2d");
			context.fillStyle = "#FFFFFF";
			//setInterval可以定时执行操作
			var speedy = 10;
			var speedx = 5;
			setInterval(function(){
				context.clearRect(0,0,canvas.width,canvas.height);
				for(var i = 0 ; i < 100 ; i++){
					snow_y[i] = snow_y[i] + speedy ;
					if(snow_y[i]>canvas.height){
						snow_y[i] = -1*Math.random()*canvas.height;
					} 
					context.font = fontSizes[i]+"px arial";
					context.fillText("*",snow_x[i],snow_y[i]);
				}
			},50);
			
			}